package com.example.onlinemarket.dao;


import com.example.onlinemarket.bean.OrderItem;
import com.example.onlinemarket.bean.mobile.EasyOrderItemInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;
@Mapper
public interface OrderItemDao {
    List<OrderItem> getOrderItemsByOrderId(Integer orderId);//按订单ID获取全部订单详情对象
    //添加新订单详情
    boolean addOrderItem(@Param("orderId") Integer orderId, @Param("goodId") Integer goodId, @Param("goodNum") Integer goodNum);
    Integer getOrderItemNum(@Param("orderId") Integer orderId, @Param("goodId") Integer goodId);//获取鲜花数量
    boolean updateOrderItemNum(@Param("orderId") Integer orderId, @Param("goodId") Integer goodId, @Param("goodNum") Integer goodNum);//更新鲜花数量
    boolean delOrderItem(@Param("orderId") Integer orderId, @Param("goodId") Integer goodId);//删除订单鲜花
    Integer checkOrderItemExist(@Param("orderId") Integer orderId, @Param("goodId") Integer goodId);
    boolean updateGoodNum(@Param("orderId") Integer orderId, @Param("goodId") Integer goodId, @Param("goodNum") Integer goodNum);//更新订购的鲜花数量
    boolean updateNote(@Param("orderId") Integer orderId, @Param("goodId") Integer goodId, @Param("note") String note);//更新订购鲜花备注
    boolean updateShopGoodStatus(@Param("userId") Integer userId, @Param("orderId") Integer orderId, @Param("goodStatus") String goodStatus);//按商家ID和订单ID获取订单中所有鲜花的ID并更新订单详情中鲜花状态
    boolean updateOrderItemStatus(@Param("orderId") Integer orderId, @Param("goodStatus") String goodStatus);//更新订单详情状态
    boolean delOrderItemsByOrderId(Integer orderId);//按订单ID删除所有相关订单详情
    boolean updateOrderItemInfo(@Param("orderId")int orderId, @Param("orderItemInfo") EasyOrderItemInfo orderItemInfo);//更新购物车单项状态
    int getOrderItemCount(int orderId);
}
